import request from '@/utils/request'

const api = '/role'

export function page(params) {
  return request({
    url: `${api}/query/page`,
    method: 'get',
    params: params
  })
}

// 修改操作
// 执行新增和修改,id是给修改的时候用的，pojo就是传过来的具体数据
export function update(id, pojo) {
  if (id === null || id === '') {
    return this.save(pojo)
  } else {
    pojo.ganhaoid = id
    return request({
      url: '/sys/user/update',
      method: 'post',
      data: pojo
    })
  }
}

// 查找一条记录
export function findById(id) {
  return request({
    url: '/sys/user/find/' + id,
    method: 'get'
  })
}

// 删除数据
export function deleteByIds(ids) {
  return request({
    url: `/sys/user/delete`,
    method: 'delete',
    data: ids
  })
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}
